<template>
	<view class='all'>
		<view class="all_1" v-for="(item,index) in info.data" style="	padding: 30rpx 30rpx 0rpx 30rpx;">
			<view class="carp">
				<view class="carp1">
					<view class="carp_1">
						<text>{{item.name}}</text>
						<text>{{item.mobile}}</text>
						<text v-if="item.is_default==1">默认</text>
					</view>
					<view class="carp_2">
						{{item.province}}
						{{item.city}}
						{{item.county}}
						<!-- 河南省 郑州市 中原区 桐柏路街道 -->
					</view>
					<view class="carp_3">
						{{item.address}}
						<!-- 普罗旺斯庄园一号楼四单元3305 -->
					</view>
				</view>
				<image @click="submit('编辑地址',item)" src="@/static/img/bj.png" mode="widthFix"></image>
			</view>
			<view class="xian">

			</view>
		</view>

		<view class="zx" @click="submit('新增地址')">
			新增地址

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {}
			};
		},
		onShow() {
			this.getinfo()
		},
		onLoad() {
		},
		methods: {
			getinfo() {
				this.$api('usermsg/address').then(res => {
					this.info = res.data
				})
			},
			submit(a, b) {
				let data = {
					name: a,
					b: b ? b : ''
				}
				if (a == '编辑地址') {
					uni.navigateTo({
						url: `./dizhibj?data=${JSON.stringify(data)}&id=${b.id}`
					})
				} else {
					uni.navigateTo({
						url: `./dizhibj?data=${JSON.stringify(data)}`
					})
				}

			}
		}
	}
</script>

<style lang="scss">
	.zx {
		width: 300rpx;
		height: 88rpx;
		background: #FFD500;
		opacity: 1;
		border-radius: 44px;
		text-align: center;
		margin: 100rpx auto;
		line-height: 88rpx;
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #703F00;
		opacity: 1;
	}

	.xian {
		height: 1rpx;
		background: #EFEFEF;
		margin-top: 30rpx;
	}

	.carp {
		display: flex;
		justify-content: space-between;
		align-items: center;

		.carp1 {
			.carp_2 {
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				display: inline-block;
				margin: 15rpx 0 10rpx 0;
				color: #666666;
				opacity: 1;
			}

			.carp_3 {
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #333333;
				opacity: 1;
			}

			.carp_1 {
				text:nth-of-type(1) {
					font-size: 28rpx;
					font-family: Source Han Sans CN;
					font-weight: 600;
					color: #333333;
					opacity: 1;
				}

				text:nth-of-type(2) {
					font-size: 28rpx;
					font-family: HarmonyOS Sans;
					font-weight: 600;
					margin: 0 20rpx 0 20rpx;
					color: #333333;
					opacity: 1;
				}

				text:nth-of-type(3) {
					position: relative;
					top: -6rpx;
					border: 1rpx solid #E61E2A;
					width: 65rpx;
					text-align: center;
					display: inline-block;
					font-size: 24rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #E61E2A;
					opacity: 1;
				}
			}
		}

		image {
			width: 40rpx;
			height: 40rpx;
		}
	}
</style>
